cc.Class({
    extends: cc.Component,

    editor: {
        executeInEditMode: true
    },
    properties: {
        maxWidth: 128,
        maxHeight : 128,
    },
    onLoad () {
        this.node.on( "position-changed", this.onChange, this );
    },
    onChange() {
        if( this.maxWidth ) {
            this.node.x = this.node.x % this.maxWidth;
        }
        if( this.maxHeight ) {
            this.node.y = this.node.y % this.maxHeight;
        }
    }
});